import os
from dotenv import load_dotenv

# 加载环境变量
load_dotenv()

class Config:
    # 智谱AI配置
    ZHIPUAI_API_KEY = os.getenv('ZHIPUAI_API_KEY', 'your_zhipuai_api_key_here')
    ZHIPUAI_MODEL = os.getenv('ZHIPUAI_MODEL', 'glm-4-air')  # 使用GLM-4模型
    
    # 数据库配置
    DATABASE_URL = os.getenv('DATABASE_URL', 'mysql+pymysql://ltt:200439Litian%40@8.137.70.232:3306/ai_intelligent_teaching_and_training_system')
    
    # 推荐系统配置
    RECOMMENDATION_ALGORITHM = os.getenv('RECOMMENDATION_ALGORITHM', 'collaborative_filtering')
    MIN_SIMILARITY_THRESHOLD = float(os.getenv('MIN_SIMILARITY_THRESHOLD', '0.3'))
    MAX_RECOMMENDATIONS = int(os.getenv('MAX_RECOMMENDATIONS', '10'))
    
    # NLP配置
    TEXT_ANALYSIS_MODEL = os.getenv('TEXT_ANALYSIS_MODEL', 'bert-base-chinese')
    SENTIMENT_THRESHOLD = float(os.getenv('SENTIMENT_THRESHOLD', '0.5'))
    
    # 学习分析配置
    LEARNING_PROGRESS_WEIGHT = float(os.getenv('LEARNING_PROGRESS_WEIGHT', '0.4'))
    PERFORMANCE_WEIGHT = float(os.getenv('PERFORMANCE_WEIGHT', '0.3'))
    INTEREST_WEIGHT = float(os.getenv('INTEREST_WEIGHT', '0.3'))
    
    # 缓存配置
    CACHE_TTL = int(os.getenv('CACHE_TTL', '3600'))  # 1小时
    
    # 日志配置
    LOG_LEVEL = os.getenv('LOG_LEVEL', 'INFO')
    LOG_FILE = os.getenv('LOG_FILE', 'ai_system.log')

    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://ltt:200439Litian%40@8.137.70.232:3306/ai_intelligent_teaching_and_training_system"